import { createContext } from "react";
import type {
  BrowserProfile,
  BrowserSession,
  QuickMessage,
  XHSCommentList,
  XHSMention,
  XHSNote,
} from "@common/models";
import { XHMUser } from "@/ui/meta/entities";

export interface GlobalModelState {
  user?: XHMUser;
  userCheckTaskId?: NodeJS.Timer;
  sessions: BrowserSession[];
  profiles: BrowserProfile[];
  currentSession?: BrowserSession;
  mentions?: {
    hasMore: boolean;
    records: XHSMention[];
  };
  discussion?: {
    ownerId: string;
    note: XHSNote;
    comments: XHSCommentList;
    sendQueue: string[];
  };
  quickMessages: QuickMessage[];
  quickMessageInput?: string;
  inputMode: "normal" | "quick-message";
  emojis: Array<{ name: string; img: string }>;
  notes?: XHSNote[];
  updating?: Record<string, boolean>;
}
export const GlobalModel = createContext<GlobalModelState | null>(null);
